package de.fhkl.strokeprotocol.messages;

import java.util.UUID;

/**
 * Message that indicates whether the sender wants to accept and download the
 * video with the given id.
 */
public class AcceptVideoMessage implements IMessage
{
	private static final long serialVersionUID = -7073013052908723740L;

	/** ID of the correspondent video */
	private UUID mVideoId;

	/** Indicates whether the sender wants to accept the video */
	private boolean mAccepted;

	/**
	 * Video part with which we want to start downloading. This allows us to
	 * continue a previously started download after it has been aborted due to a
	 * connection loss.
	 */
	private int mStartWithPart;

	/**
	 * Message that indicates whether the sender wants to accept and download
	 * the video with the given id.
	 * 
	 * @param videoId
	 * @param accepted
	 */
	public AcceptVideoMessage(UUID videoId, boolean accepted)
	{
		this(videoId, accepted, 0);
	}

	/**
	 * Message that indicates whether the sender wants to accept and download
	 * the video with the given id. Download starts with part with the given
	 * part number.
	 * 
	 * @param videoId
	 * @param accepted
	 * @param startWithPart
	 */
	public AcceptVideoMessage(UUID videoId, boolean accepted, int startWithPart)
	{
		mVideoId = videoId;
		mAccepted = accepted;
		mStartWithPart = startWithPart;
	}

	/**
	 * Get ID of the correspondent video.
	 * 
	 * @return
	 */
	public UUID getVideoId()
	{
		return mVideoId;
	}

	/**
	 * Set ID of the correspondent video.
	 * 
	 * @param videoId
	 */
	public void setVideoId(UUID videoId)
	{
		mVideoId = videoId;
	}

	/**
	 * Does the user want to accept and download the video?
	 * 
	 * @return
	 */
	public boolean isAccepted()
	{
		return mAccepted;
	}

	/**
	 * Set whether the user wants to accept and download the video.
	 * 
	 * @param accepted
	 */
	public void setAccepted(boolean accepted)
	{
		mAccepted = accepted;
	}

	/**
	 * Returns the video part with which we want to start downloading. This
	 * allows us to continue a previously started download after it has been
	 * aborted due to a connection loss.
	 * 
	 * @return
	 */
	public int getStartWithPart()
	{
		return mStartWithPart;
	}

	/**
	 * Sets the video part with which we want to start downloading. This allows
	 * us to continue a previously started download after it has been aborted
	 * due to a connection loss.
	 * 
	 * @param startWithPart
	 */
	public void setStartWithPart(int startWithPart)
	{
		mStartWithPart = startWithPart;
	}
}
